package com.project.service.sms;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;

import com.dtyunxi.util.JacksonUtil;
import com.project.common.Constants;
import com.project.entity.sms.CommAppVo;
import com.project.entity.sms.SmsMessageVo;
import com.project.util.HttpRequest;

@Service
public class SmsService{
	private static final Logger logger = LoggerFactory.getLogger(SmsService.class);
	
	@Autowired
	private Environment env;
	
	public String sendSms(SmsMessageVo smsMessageVo){
		CommAppVo commAppVo = new CommAppVo(env.getProperty("sms_appid"), env.getProperty("sms_appsecrect"));
		smsMessageVo.setSignType("云徙科技");
		String smsMessageVoJson = JacksonUtil.toJson(smsMessageVo);
		logger.info("发送短信 sendSms. SmsMessageVo:{}",smsMessageVoJson);
		String params = "commAppVo="+JacksonUtil.toJson(commAppVo)+"&smsMessageVo="+smsMessageVoJson;
		String result = HttpRequest.sendPost(env.getProperty("qinqu_gateway_send_sms_path"),params);
		logger.info("发送短信返回 . result:{}",result);
		return null;
	}

}
